home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Editions.p < prev    next >
Text File  |  1996-05-01  |  14KB  |  431 lines

  1. {
  2.      File:        Editions.p
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Editions;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __EDITIONS__}
  28. {$SETC __EDITIONS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC EditionsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __MEMORY__}
  35. {$I Memory.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __FILES__}
  41. {$I Files.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __ALIASES__}
  44. {$I Aliases.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __DIALOGS__}
  47. {$I Dialogs.p}
  48. {$ENDC}
  49.  
  50. {$PUSH}
  51. {$ALIGN MAC68K}
  52. {$LibExport+}
  53.  
  54. {$IFC FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
  55.  
  56. CONST
  57.                                                                 {  resource types   }
  58.     rSectionType                = 'sect';                        {  ResType of saved SectionRecords  }
  59.                                                                 {  Finder types for edition files  }
  60.     kPICTEditionFileType        = 'edtp';
  61.     kTEXTEditionFileType        = 'edtt';
  62.     ksndEditionFileType            = 'edts';
  63.     kUnknownEditionFileType        = 'edtu';
  64.     kPublisherDocAliasFormat    = 'alis';
  65.     kPreviewFormat                = 'prvw';
  66.     kFormatListFormat            = 'fmts';
  67.  
  68.                                                                 {  section types  }
  69.     stSubscriber                = $01;
  70.     stPublisher                    = $0A;
  71.     sumAutomatic                = 0;                            {  subscriber update mode - Automatically      }
  72.     sumManual                    = 1;                            {  subscriber update mode - Manually  }
  73.     pumOnSave                    = 0;                            {  publisher update mode - OnSave             }
  74.     pumManual                    = 1;                            {  publisher update mode - Manually  }
  75.     kPartsNotUsed                = 0;
  76.     kPartNumberUnknown            = -1;                            {  misc  }
  77.     kPreviewWidth                = 120;
  78.     kPreviewHeight                = 120;                            {  bits for formatsMask  }
  79.     kPICTformatMask                = 1;
  80.     kTEXTformatMask                = 2;
  81.     ksndFormatMask                = 4;
  82.  
  83. {
  84.  pseudo-item hits for dialogHooks 
  85.  the first if for NewPublisher or NewSubscriber Dialogs 
  86. }
  87.     emHookRedrawPreview            = 150;                            {  the following are for SectionOptions Dialog  }
  88.     emHookCancelSection            = 160;
  89.     emHookGoToPublisher            = 161;
  90.     emHookGetEditionNow            = 162;
  91.     emHookSendEditionNow        = 162;
  92.     emHookManualUpdateMode        = 163;
  93.     emHookAutoUpdateMode        = 164;
  94.  
  95. {
  96.  the refcon field of the dialog record during a modalfilter 
  97.  or dialoghook contains one the following 
  98. }
  99.     emOptionsDialogRefCon        = 'optn';
  100.     emCancelSectionDialogRefCon    = 'cncl';
  101.     emGoToPubErrDialogRefCon    = 'gerr';
  102.     kFormatLengthUnknown        = -1;
  103.  
  104. {  one byte, stSubscriber or stPublisher  }
  105.  
  106. TYPE
  107.     SectionType                            = SignedByte;
  108. {  seconds since 1904  }
  109.     TimeStamp                            = LONGINT;
  110. {  similar to ResType  }
  111.     FormatType                            = FourCharCode;
  112. {  used in Edition I/O  }
  113.     EditionRefNum                        = Handle;
  114. {  update modes  }
  115. {  sumAutomatic, pumSuspend, etc  }
  116.     UpdateMode                            = INTEGER;
  117.     SectionRecordPtr = ^SectionRecord;
  118.     SectionPtr                            = ^SectionRecord;
  119.     SectionHandle                        = ^SectionPtr;
  120.     SectionRecord = RECORD
  121.         version:                SignedByte;                                {  always 0x01 in system 7.0  }
  122.         kind:                    SectionType;                            {  stSubscriber or stPublisher  }
  123.         mode:                    UpdateMode;                                {  auto or manual  }
  124.         mdDate:                    TimeStamp;                                {  last change in document  }
  125.         sectionID:                LONGINT;                                {  app. specific, unique per document  }
  126.         refCon:                    LONGINT;                                {  application specific  }
  127.         alias:                    AliasHandle;                            {  handle to Alias Record  }
  128.         subPart:                LONGINT;                                {  which part of container file  }
  129.         nextSection:            SectionHandle;                            {  for linked list of app's Sections  }
  130.         controlBlock:            Handle;                                    {  used internally  }
  131.         refNum:                    EditionRefNum;                            {  used internally  }
  132.     END;
  133.  
  134.     EditionContainerSpecPtr = ^EditionContainerSpec;
  135.     EditionContainerSpec = RECORD
  136.         theFile:                FSSpec;
  137.         theFileScript:            ScriptCode;
  138.         thePart:                LONGINT;
  139.         thePartName:            Str31;
  140.         thePartScript:            ScriptCode;
  141.     END;
  142.  
  143.     EditionInfoRecordPtr = ^EditionInfoRecord;
  144.     EditionInfoRecord = RECORD
  145.         crDate:                    TimeStamp;                                {  date EditionContainer was created  }
  146.         mdDate:                    TimeStamp;                                {  date of last change  }
  147.         fdCreator:                OSType;                                    {  file creator  }
  148.         fdType:                    OSType;                                    {  file type  }
  149.         container:                EditionContainerSpec;                    {  the Edition  }
  150.     END;
  151.  
  152.     NewPublisherReplyPtr = ^NewPublisherReply;
  153.     NewPublisherReply = RECORD
  154.         canceled:                BOOLEAN;                                {  O  }
  155.         replacing:                BOOLEAN;
  156.         usePart:                BOOLEAN;                                {  I  }
  157.         filler:                    SInt8;
  158.         preview:                Handle;                                    {  I  }
  159.         previewFormat:            FormatType;                                {  I  }
  160.         container:                EditionContainerSpec;                    {  I/O  }
  161.     END;
  162.  
  163.     NewSubscriberReplyPtr = ^NewSubscriberReply;
  164.     NewSubscriberReply = RECORD
  165.         canceled:                BOOLEAN;                                {  O  }
  166.         formatsMask:            SignedByte;
  167.         container:                EditionContainerSpec;                    { I/O }
  168.     END;
  169.  
  170.     SectionOptionsReplyPtr = ^SectionOptionsReply;
  171.     SectionOptionsReply = RECORD
  172.         canceled:                BOOLEAN;                                {  O  }
  173.         changed:                BOOLEAN;                                {  O  }
  174.         sectionH:                SectionHandle;                            {  I  }
  175.         action:                    ResType;                                {  O  }
  176.     END;
  177.  
  178.     ExpModalFilterProcPtr = ProcPtr;  { FUNCTION ExpModalFilter(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
  179.  
  180.     ExpDlgHookProcPtr = ProcPtr;  { FUNCTION ExpDlgHook(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
  181.  
  182.     ExpModalFilterUPP = UniversalProcPtr;
  183.     ExpDlgHookUPP = UniversalProcPtr;
  184.  
  185. CONST
  186.     uppExpModalFilterProcInfo = $0000FBD0;
  187.     uppExpDlgHookProcInfo = $00003EA0;
  188.  
  189. FUNCTION NewExpModalFilterProc(userRoutine: ExpModalFilterProcPtr): ExpModalFilterUPP;
  190.     {$IFC NOT GENERATINGCFM }
  191.     INLINE $2E9F;
  192.     {$ENDC}
  193.  
  194. FUNCTION NewExpDlgHookProc(userRoutine: ExpDlgHookProcPtr): ExpDlgHookUPP;
  195.     {$IFC NOT GENERATINGCFM }
  196.     INLINE $2E9F;
  197.     {$ENDC}
  198.  
  199. FUNCTION CallExpModalFilterProc(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr; userRoutine: ExpModalFilterUPP): BOOLEAN;
  200.     {$IFC NOT GENERATINGCFM}
  201.     INLINE $205F, $4E90;
  202.     {$ENDC}
  203.  
  204. FUNCTION CallExpDlgHookProc(itemOffset: INTEGER; itemHit: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr; userRoutine: ExpDlgHookUPP): INTEGER;
  205.     {$IFC NOT GENERATINGCFM}
  206.     INLINE $205F, $4E90;
  207.     {$ENDC}
  208.  
  209. CONST
  210.     ioHasFormat                    = 0;
  211.     ioReadFormat                = 1;
  212.     ioNewFormat                    = 2;
  213.     ioWriteFormat                = 3;
  214.  
  215.  
  216. TYPE
  217.     FormatIOVerb                        = SignedByte;
  218.  
  219. CONST
  220.     eoOpen                        = 0;
  221.     eoClose                        = 1;
  222.     eoOpenNew                    = 2;
  223.     eoCloseNew                    = 3;
  224.     eoCanSubscribe                = 4;
  225.  
  226.  
  227. TYPE
  228.     EditionOpenerVerb                    = SignedByte;
  229.     FormatIOParamBlockPtr = ^FormatIOParamBlock;
  230.     FormatIOParamBlock = RECORD
  231.         ioRefNum:                LONGINT;
  232.         format:                    FormatType;
  233.         formatIndex:            LONGINT;
  234.         offset:                    LONGINT;
  235.         buffPtr:                Ptr;
  236.         buffLen:                LONGINT;
  237.     END;
  238.  
  239.     EditionOpenerParamBlockPtr = ^EditionOpenerParamBlock;
  240.     FormatIOProcPtr = ProcPtr;  { FUNCTION FormatIO(selector: FormatIOVerb; VAR PB: FormatIOParamBlock): INTEGER; }
  241.  
  242.     EditionOpenerProcPtr = ProcPtr;  { FUNCTION EditionOpener(selector: EditionOpenerVerb; VAR PB: EditionOpenerParamBlock): INTEGER; }
  243.  
  244.     FormatIOUPP = UniversalProcPtr;
  245.     EditionOpenerUPP = UniversalProcPtr;
  246.     EditionOpenerParamBlock = RECORD
  247.         info:                    EditionInfoRecord;
  248.         sectionH:                SectionHandle;
  249.         document:                FSSpecPtr;
  250.         fdCreator:                OSType;
  251.         ioRefNum:                LONGINT;
  252.         ioProc:                    FormatIOUPP;
  253.         success:                BOOLEAN;
  254.         formatsMask:            SignedByte;
  255.     END;
  256.  
  257.  
  258. CONST
  259.     uppFormatIOProcInfo = $00000360;
  260.     uppEditionOpenerProcInfo = $00000360;
  261.  
  262. FUNCTION NewFormatIOProc(userRoutine: FormatIOProcPtr): FormatIOUPP;
  263.     {$IFC NOT GENERATINGCFM }
  264.     INLINE $2E9F;
  265.     {$ENDC}
  266.  
  267. FUNCTION NewEditionOpenerProc(userRoutine: EditionOpenerProcPtr): EditionOpenerUPP;
  268.     {$IFC NOT GENERATINGCFM }
  269.     INLINE $2E9F;
  270.     {$ENDC}
  271. {
  272.  Section events now arrive in the message buffer using the AppleEvent format.
  273.  The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  274.  ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  275.  The following is a sample buffer
  276.  
  277.  name       offset     contents
  278.  ----       ------     --------
  279.  header           0      'aevt'
  280.  majorVersion     4      0x01
  281.  minorVersion     6      0x01
  282.  endOfMetaData     8      ';;;;' 
  283.  directObjKey     12  '----' 
  284.  paramType      16  'tid ' 
  285.  paramLength      20  0x0008 
  286.  tempIDType      24  'sect' 
  287.  tempID            28  the SectionHandle <-- this is want you want
  288. }
  289.  
  290. CONST
  291.     sectionEventMsgClass        = 'sect';
  292.     sectionReadMsgID            = 'read';
  293.     sectionWriteMsgID            = 'writ';
  294.     sectionScrollMsgID            = 'scrl';
  295.     sectionCancelMsgID            = 'cncl';
  296.  
  297.     currentEditionMgrVers        = $0011;
  298.  
  299. { Use InitEditionPackVersion(currentEditionMgrVers) instead of InitEditionPack }
  300. FUNCTION InitEditionPackVersion(curEditionMgrVers: INTEGER): OSErr;
  301.     {$IFC NOT GENERATINGCFM}
  302.     INLINE $303C, $0100, $A82D;
  303.     {$ENDC}
  304. FUNCTION NewSection({CONST}VAR container: EditionContainerSpec; sectionDocument: ConstFSSpecPtr; kind: SectionType; sectionID: LONGINT; initalMode: UpdateMode; VAR sectionH: SectionHandle): OSErr;
  305.     {$IFC NOT GENERATINGCFM}
  306.     INLINE $303C, $0A02, $A82D;
  307.     {$ENDC}
  308. FUNCTION RegisterSection({CONST}VAR sectionDocument: FSSpec; sectionH: SectionHandle; VAR aliasWasUpdated: BOOLEAN): OSErr;
  309.     {$IFC NOT GENERATINGCFM}
  310.     INLINE $303C, $0604, $A82D;
  311.     {$ENDC}
  312. FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  313.     {$IFC NOT GENERATINGCFM}
  314.     INLINE $303C, $0206, $A82D;
  315.     {$ENDC}
  316. FUNCTION IsRegisteredSection(sectionH: SectionHandle): OSErr;
  317.     {$IFC NOT GENERATINGCFM}
  318.     INLINE $303C, $0208, $A82D;
  319.     {$ENDC}
  320. FUNCTION AssociateSection(sectionH: SectionHandle; {CONST}VAR newSectionDocument: FSSpec): OSErr;
  321.     {$IFC NOT GENERATINGCFM}
  322.     INLINE $303C, $040C, $A82D;
  323.     {$ENDC}
  324. FUNCTION CreateEditionContainerFile({CONST}VAR editionFile: FSSpec; fdCreator: OSType; editionFileNameScript: ScriptCode): OSErr;
  325.     {$IFC NOT GENERATINGCFM}
  326.     INLINE $303C, $050E, $A82D;
  327.     {$ENDC}
  328. FUNCTION DeleteEditionContainerFile({CONST}VAR editionFile: FSSpec): OSErr;
  329.     {$IFC NOT GENERATINGCFM}
  330.     INLINE $303C, $0210, $A82D;
  331.     {$ENDC}
  332. FUNCTION OpenEdition(subscriberSectionH: SectionHandle; VAR refNum: EditionRefNum): OSErr;
  333.     {$IFC NOT GENERATINGCFM}
  334.     INLINE $303C, $0412, $A82D;
  335.     {$ENDC}
  336. FUNCTION OpenNewEdition(publisherSectionH: SectionHandle; fdCreator: OSType; publisherSectionDocument: ConstFSSpecPtr; VAR refNum: EditionRefNum): OSErr;
  337.     {$IFC NOT GENERATINGCFM}
  338.     INLINE $303C, $0814, $A82D;
  339.     {$ENDC}
  340. FUNCTION CloseEdition(whichEdition: EditionRefNum; successful: BOOLEAN): OSErr;
  341.     {$IFC NOT GENERATINGCFM}
  342.     INLINE $303C, $0316, $A82D;
  343.     {$ENDC}
  344. FUNCTION EditionHasFormat(whichEdition: EditionRefNum; whichFormat: FormatType; VAR formatSize: Size): OSErr;
  345.     {$IFC NOT GENERATINGCFM}
  346.     INLINE $303C, $0618, $A82D;
  347.     {$ENDC}
  348. FUNCTION ReadEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; VAR buffLen: Size): OSErr;
  349.     {$IFC NOT GENERATINGCFM}
  350.     INLINE $303C, $081A, $A82D;
  351.     {$ENDC}
  352. FUNCTION WriteEdition(whichEdition: EditionRefNum; whichFormat: FormatType; buffPtr: UNIV Ptr; buffLen: Size): OSErr;
  353.     {$IFC NOT GENERATINGCFM}
  354.     INLINE $303C, $081C, $A82D;
  355.     {$ENDC}
  356. FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; VAR currentMark: LONGINT): OSErr;
  357.     {$IFC NOT GENERATINGCFM}
  358.     INLINE $303C, $061E, $A82D;
  359.     {$ENDC}
  360. FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType; setMarkTo: LONGINT): OSErr;
  361.     {$IFC NOT GENERATINGCFM}
  362.     INLINE $303C, $0620, $A82D;
  363.     {$ENDC}
  364. FUNCTION GetEditionInfo(sectionH: SectionHandle; VAR editionInfo: EditionInfoRecord): OSErr;
  365.     {$IFC NOT GENERATINGCFM}
  366.     INLINE $303C, $0422, $A82D;
  367.     {$ENDC}
  368. FUNCTION GoToPublisherSection({CONST}VAR container: EditionContainerSpec): OSErr;
  369.     {$IFC NOT GENERATINGCFM}
  370.     INLINE $303C, $0224, $A82D;
  371.     {$ENDC}
  372. FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;
  373.     {$IFC NOT GENERATINGCFM}
  374.     INLINE $303C, $0226, $A82D;
  375.     {$ENDC}
  376. FUNCTION GetStandardFormats({CONST}VAR container: EditionContainerSpec; VAR previewFormat: FormatType; preview: Handle; publisherAlias: Handle; formats: Handle): OSErr;
  377.     {$IFC NOT GENERATINGCFM}
  378.     INLINE $303C, $0A28, $A82D;
  379.     {$ENDC}
  380. FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerUPP): OSErr;
  381.     {$IFC NOT GENERATINGCFM}
  382.     INLINE $303C, $022A, $A82D;
  383.     {$ENDC}
  384. FUNCTION SetEditionOpenerProc(opener: EditionOpenerUPP): OSErr;
  385.     {$IFC NOT GENERATINGCFM}
  386.     INLINE $303C, $022C, $A82D;
  387.     {$ENDC}
  388. FUNCTION CallEditionOpenerProc(selector: EditionOpenerVerb; VAR PB: EditionOpenerParamBlock; routine: EditionOpenerUPP): OSErr;
  389.     {$IFC NOT GENERATINGCFM}
  390.     INLINE $303C, $052E, $A82D;
  391.     {$ENDC}
  392. FUNCTION CallFormatIOProc(selector: FormatIOVerb; VAR PB: FormatIOParamBlock; routine: FormatIOUPP): OSErr;
  393.     {$IFC NOT GENERATINGCFM}
  394.     INLINE $303C, $0530, $A82D;
  395.     {$ENDC}
  396. FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  397.     {$IFC NOT GENERATINGCFM}
  398.     INLINE $303C, $0232, $A82D;
  399.     {$ENDC}
  400. FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  401.     {$IFC NOT GENERATINGCFM}
  402.     INLINE $303C, $0B34, $A82D;
  403.     {$ENDC}
  404. FUNCTION NewPublisherDialog(VAR reply: NewPublisherReply): OSErr;
  405.     {$IFC NOT GENERATINGCFM}
  406.     INLINE $303C, $0236, $A82D;
  407.     {$ENDC}
  408. FUNCTION NewPublisherExpDialog(VAR reply: NewPublisherReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  409.     {$IFC NOT GENERATINGCFM}
  410.     INLINE $303C, $0B38, $A82D;
  411.     {$ENDC}
  412. FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  413.     {$IFC NOT GENERATINGCFM}
  414.     INLINE $303C, $023A, $A82D;
  415.     {$ENDC}
  416. FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply; where: Point; expansionDITLresID: INTEGER; dlgHook: ExpDlgHookUPP; filter: ExpModalFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  417.     {$IFC NOT GENERATINGCFM}
  418.     INLINE $303C, $0B3C, $A82D;
  419.     {$ENDC}
  420. {$ENDC}
  421. {$ALIGN RESET}
  422. {$POP}
  423.  
  424. {$SETC UsingIncludes := EditionsIncludes}
  425.  
  426. {$ENDC} {__EDITIONS__}
  427.  
  428. {$IFC NOT UsingIncludes}
  429.  END.
  430. {$ENDC}
  431.